package com.genreate.start;

import cn.hutool.core.collection.ListUtil;
import cn.hutool.core.lang.Dict;
import cn.hutool.core.util.StrUtil;
import cn.hutool.db.Entity;
import com.genreate.util.dbUtil.DbUtil;
import com.genreate.constant.GenType;
import com.genreate.util.autoBuild.contsant.DatabaseType;
import com.genreate.config.BuildGenConfig;
import com.genreate.util.dbUtil.JdbcConfig;

import java.util.List;

/**
 * 开始运行
 *
 * @author Administrator
 * @date 2023/08/17
 */
public class StartRun {

    public static void main(String[] args) {
//        List<String> tableNames = ListUtil.of("pump_area","pump_data_1","pump_device","pump_inspection","pump_ledger","pump_operation","pump_team","pump_video","pump_video");
        List<String> tableNames = ListUtil.of("ljhl_user_feedback_copy");
        for (String tableName : tableNames) {
            ljhl(tableName);
        }
    }

    /**
     * 零距互联
     */
    private static void ljhl(String tableName) {
        //其他属性路径位置
        Dict configPath = Dict.create()
                .set("pathR","com.library.basic.R")
                .set("pathPageQuery","com.microservices.web.page.PageQuery")
                .set("pathTableDataInfo","com.microservices.web.page.TableDataInfo")
                ;
        BuildGenConfig buildGenConfig = new BuildGenConfig();
        buildGenConfig.setDatabaseType(DatabaseType.MYSQL).setTableName(tableName)
                .setJdbcConfig(JdbcConfig.mysql_localhost_microservices())
                .setGenType(GenType.LJHL)
                .setPathConfig(configPath)
                //路径前缀
                .setPathPrefix("D:\\ideaWorkspace\\microservices\\microservices-modules\\microservices-modules-user")
                //包名
                .setPackageName("com.microservices")
//                .setPermissionPrefix("ljhl")
        //模块名
//                .setModuleName("generate")
        ;
        DbUtil.generatorCode(buildGenConfig);
    }

    /**
     * 泵站
     */
    private static void pump(String tableName) {
        //其他属性路径位置
        Dict configPath = Dict.create()
                .set("pathR","com.ruoyi.pump.constant.R")
                .set("pathPageQuery","com.ruoyi.pump.constant.page.PageQuery")
                .set("pathTableDataInfo","com.ruoyi.pump.constant.page.TableDataInfo")
                .set("pathPoiUtils","com.ruoyi.pump.util.PoiUtils")
                ;
        BuildGenConfig buildGenConfig = new BuildGenConfig();
        buildGenConfig.setDatabaseType(DatabaseType.MYSQL).setTableName(tableName)
                .setJdbcConfig(JdbcConfig.mysql_localhost_yys_pump())
                .setGenType(GenType.PUMP)
                .setPathConfig(configPath)
                //路径前缀
                .setPathPrefix("D:\\workspace\\yys-huanwei-cloud\\yys-modules\\yys-pump")
                //包名
                .setPackageName("com.ruoyi.pump")
                .setPermissionPrefix("pump")
        //模块名
//                .setModuleName("generate")
        ;
        DbUtil.generatorCode(buildGenConfig);
    }

    /**
     * 巡查管理相关代码
     */
    private static void xcgl() {
        //其他属性路径位置
        Dict configPath = Dict.create()
                .set("pathDbUtil","common.jdbc.DbUtil")
                .set("pathR","common.utils.result.R")
                .set("pathPage","common.jdbc.Page")
                .set("pathPoiUtils","common.utils.PoiUtils");
        BuildGenConfig buildGenConfig = new BuildGenConfig();
        buildGenConfig.setDatabaseType(DatabaseType.SQLSERVER).setTableName("bj_road_bridge")
                .setGenType(GenType.XCGL)
                .setPathConfig(configPath)
                //路径前缀
                .setPathPrefix("D:\\project\\tl_yhgl_green\\xcgl")
                //包名
                .setPackageName("generate")
                //模块名
                .setModuleName("generate")
        ;
        DbUtil.generatorCode(buildGenConfig);
    }

    /**
     * 驾驶舱相关代码 本地测试
     */
    private static void bigScreenNow() {
        //其他属性路径位置
        Dict configPath = Dict.create()
                //本地
                .set("pathR","com.util.domain.R")
                .set("pathPageQuery","com.util.domain.page.PageQuery")
                .set("pathTableDataInfo","com.util.domain.page.TableDataInfo")
                ;
        BuildGenConfig buildGenConfig = new BuildGenConfig();
        buildGenConfig.setDatabaseType(DatabaseType.SQLSERVER).setTableName("bj_mtg_data_investigate")
                .setGenType(GenType.BIGSCREEN)
                .setPathConfig(configPath)
        ;
        DbUtil.generatorCode(buildGenConfig);
    }

    /**
     * 驾驶舱相关代码
     */
    private static void bigScreen() {
        //其他属性路径位置
        Dict configPath = Dict.create()
                .set("pathR","com.yys.screendisplay.utils.R")
                .set("pathPageQuery","com.yys.screendisplay.entity.bj.PageQuery")
                .set("pathTableDataInfo","com.yys.screendisplay.entity.bj.TableDataInfo")
                ;
        BuildGenConfig buildGenConfig = new BuildGenConfig();
        buildGenConfig.setDatabaseType(DatabaseType.SQLSERVER).setTableName("bj_mtg_data_investigate")
                .setGenType(GenType.BIGSCREEN)
                .setPathConfig(configPath)
                //路径前缀
                .setPathPrefix("D:\\project\\tl_bigScreen")
                //包名
                .setPackageName("com.yys.screendisplay")
                //模块名
                .setModuleName("generate")
        ;
        DbUtil.generatorCode(buildGenConfig);
    }

    /**
     * 一树一码
     */
    private static void bigScreenTree() {
        //其他属性路径位置
        Dict configPath = Dict.create()
                .set("pathR","com.yys.green.utils.result.R")
                .set("pathPageQuery","com.yys.green.utils.result.PageQuery")
                .set("pathTableDataInfo","com.yys.green.utils.result.TableDataInfo")
                .set("pathPoiUtils","com.yys.green.utils.excelUtil.util.PoiUtils")
                ;
        BuildGenConfig buildGenConfig = new BuildGenConfig();
        buildGenConfig.setDatabaseType(DatabaseType.SQLSERVER).setTableName("warning_sms")
                .setGenType(GenType.BIGSCREEN)
                .setPathConfig(configPath)
                //路径前缀
                .setPathPrefix("D:\\workspace\\tl\\tl-tree-qrcode")
                //包名
                .setPackageName("com.yys.green")
                //模块名
//                .setModuleName("generate")
        ;
        DbUtil.generatorCode(buildGenConfig);
    }
}
